Login

Here we describe the various methods/functions that can be used with our Javascript:

  • The flux.get method
  • The flux.track method
  • Event listeners

The get method

The flux.get method can be used to retrieve resolved tokens that have been returned recently.

When tracking occurs, any resolveToken requests are returned and added to a resolvedTokens object.

The flux.get method accesses this object and returns the value.

For example, to get the current visitor ID:

flux.get('{visitor}')

To get current node ID:

flux.get('{current-node-id}')

And for any other tokens you have set in fluxOptions or sent in a view request manually:

flux.get('{token-name}')

The track method

The track method is for sending views and conversions.

These are detailed fully in their dedicated documents:

The two events are:

flux.track('view', 
  { optional tracking attributes object }, 
  optionalCallbackFunction
)

and

flux.track('conversion', 
  { conversion tracking attributes object }, 
  optionalCallbackFunction
)

Event listeners

FunnelFlux JS no longer required event listeners to guarantee sequencing of conversions.

However, you can still tap into our JS events to trigger other events.

Currently there are two available, examples below:

document.addEventListener('fluxView', function(){
  console.log('Flux view completed')
})
document.addEventListener('fluxConversion', function(){
  console.log('Flux conversion completed')
})

Or in the case of firing other functions:

document.addEventListener('fluxView', functionToCall)
document.addEventListener('fluxConversion', functionToCall)